1. Technical Field
The present invention relates to a data storage apparatus, and particularly to control of a buffer memory that temporarily retains data therein when the data is read from and written in a recording medium such as a magnetic disk.
2. Description of the Related Art
In an external storage apparatus of a computer, including a magnetic disk apparatus (hard disk drive), a buffer memory (DRAM: Dynamic Random Access Memory) called a sector buffer is prepared as means for improving the performance of a data read/write process. Caching (retaining) of a data write request (including write data) sent from a host system or once-read data has conventionally been performed.
A data structure called a ring buffer is generally used for the sector buffer. The ring buffer is a technique for coupling the beginning and end of a buffer and thereby handling a finite-length buffer as an infinite-length one (see Patent Documents 1 and 2, for example).
FIG. 5 is a conceptual diagram showing the configuration of a ring buffer. As shown in FIG. 5, the ring buffer manages an aggregation significant as continuous data as a segment while using a memory area of each sector buffer in order from a buffer bottom thereof to a buffer top thereof. After the sector buffer has been used up to the buffer top, the ring buffer returns to the buffer bottom, where the use of the sector buffer is continued. Thus, a ring is semantically (logically) formed.
Since the sector buffer is used in order, the above-described ring buffer system is suitable for use in a command processing format for processing commands in turn. On the other hand, command's reordering or the like has been performed to further improve the performance of a data read/write process in these days. The reordering is to reorder an execution sequence of commands for reading and writing data in such a manner that the waiting time required up to the execution of writing or reading of the data becomes the shortest. Suitably rearranging the processing sequence of commands by reordering or the like and executing the commands will cause complexity of segment management of the segment buffer in the form of a write request and read data being mixed.